home *** CD-ROM | disk | FTP | other *** search
/ Scene 96 / Scene 96 International Edition (Zyklop Software) (Disc 2) (1997).iso / misc / coding / midas060 / src / midasfx.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-01-16  |  9.0 KB  |  298 lines

  1. /*      midasfx.h
  2.  *
  3.  * MIDAS sound effect library
  4.  *
  5.  * $Id: midasfx.h,v 1.3 1997/01/16 18:41:59 pekangas Exp $
  6.  *
  7.  * Copyright 1996,1997 Housemarque Inc.
  8.  *
  9.  * This file is part of the MIDAS Sound System, and may only be
  10.  * used, modified and distributed under the terms of the MIDAS
  11.  * Sound System license, LICENSE.TXT. By continuing to use,
  12.  * modify or distribute this file you indicate that you have
  13.  * read the license and understand and accept it fully.
  14. */
  15.  
  16.  
  17. #ifndef __midasfx_h
  18. #define __midasfx_h
  19.  
  20.  
  21.  
  22. /****************************************************************************\
  23. *       enum fxChannels
  24. *       ---------------
  25. * Description:  Possible values for effect channel numbers apart from regular
  26. *               channel numbers
  27. \****************************************************************************/
  28.  
  29. enum fxChannels
  30. {
  31.     fxAutoChannel = 0xFFFF
  32. };
  33.  
  34.  
  35.  
  36. /****************************************************************************\
  37. *       struct fxChannel
  38. *       ----------------
  39. * Description:  Sound effect channel structure
  40. \****************************************************************************/
  41.  
  42. typedef struct
  43. {
  44.     unsigned    sdChannel;              /* Sound Device channel number */
  45.     unsigned    sampleHandle;           /* Handle for the sample that is
  46.                                            being played on this channel */
  47.     unsigned    playHandle;             /* Playing handle for the sound on
  48.                                            this channel */
  49.     int         priority;               /* Channel sound priority */
  50. } fxChannel;
  51.  
  52.  
  53.  
  54. #ifdef __cplusplus
  55. extern "C" {
  56. #endif
  57.  
  58.  
  59.  
  60. /****************************************************************************\
  61. *
  62. * Function:     int fxInit(SoundDevice *SD)
  63. *
  64. * Description:  Initializes the sound effect library
  65. *
  66. * Input:        SoundDevice *SD         Pointer to the Sound Device that will
  67. *                                       be used for playing the effects
  68. *
  69. * Returns:      MIDAS error code
  70. *
  71. \****************************************************************************/
  72.  
  73. int CALLING fxInit(SoundDevice *SD);
  74.  
  75.  
  76.  
  77.  
  78. /****************************************************************************\
  79. *
  80. * Function:     int fxClose(void)
  81. *
  82. * Description:  Uninitializes the sound effect library
  83. *
  84. * Returns:      MIDAS error code
  85. *
  86. \****************************************************************************/
  87.  
  88. int CALLING fxClose(void);
  89.  
  90.  
  91.  
  92.  
  93. /****************************************************************************\
  94. *
  95. * Function:     int fxLoadRawSample(char *fileName, unsigned sampleType,
  96. *                   int loopSample, unsigned *sampleHandle)
  97. *
  98. * Description:  Loads a raw sample file into memory and adds the sample to
  99. *               the sound device.
  100. *
  101. * Input:        char *fileName          sample file name
  102. *               unsigned sampleType     sample type, see enum sdSampleType
  103. *               int loopSample          1 if sample is looped, 0 if not
  104. *               unsigned *sampleHandle  pointer to sample handle variable
  105. *
  106. * Returns:      MIDAS error code. The sample handle for the sample will be
  107. *               written to *sampleHandle.
  108. *
  109. \****************************************************************************/
  110.  
  111. int CALLING fxLoadRawSample(char *fileName, unsigned sampleType,
  112.     int loopSample, unsigned *sampleHandle);
  113.  
  114.  
  115.  
  116.  
  117. /****************************************************************************\
  118. *
  119. * Function:     int fxFreeSample(unsigned sample)
  120. *
  121. * Description:  Deallocates a sample and frees it from the Sound Device.
  122. *
  123. * Input:        unsigned sample         sample handle for the sample to be
  124. *                                       deallocated.
  125. *
  126. * Returns:      MIDAS error code
  127. *
  128. \****************************************************************************/
  129.  
  130. int CALLING fxFreeSample(unsigned sample);
  131.  
  132.  
  133.  
  134.  
  135. /****************************************************************************\
  136. *
  137. * Function:     int fxSetAutoChannels(int numChannels,
  138. *                   unsigned *channelNumbers)
  139. *
  140. * Description:  Sets the channel numbers that can be used as automatic effect
  141. *               channels.
  142. *
  143. * Input:        int numChannels             number of channels that can be
  144. *                                           used
  145. *               unsigned *channelNumbers    pointer to a table that contains
  146. *                                           the channels that can be used
  147. *
  148. * Returns:      MIDAS error code
  149. *
  150. \****************************************************************************/
  151.  
  152. int CALLING fxSetAutoChannels(int numChannels, unsigned *channelNumbers);
  153.  
  154.  
  155.  
  156.  
  157. /****************************************************************************\
  158. *
  159. * Function:     int fxPlaySample(unsigned channel, unsigned sample,
  160. *                   int priority, unsigned rate, unsigned volume, int panning,
  161. *                   unsigned *playHandle)
  162. *
  163. * Description:  Starts playing a sound effect sample on a channel
  164. *
  165. * Input:        unsigned channel        channel number, or fxAutoChannel for
  166. *                                       automatic selection
  167. *               unsigned sample         sample handle
  168. *               int priority            effect priority, the higher the value
  169. *                                       the higher the priority
  170. *               unsigned rate           effect initial sample rate
  171. *               unsigned volume         effect initial volume (0-64)
  172. *               int panning             effect initial panning, see enum
  173. *                                       sdPanning
  174. *               unsigned *playHandle    effect playing handle variable
  175. *
  176. * Returns:      MIDAS error code. The playing handle for the effect will be
  177. *               written to *playHandle.
  178. *
  179. \****************************************************************************/
  180.  
  181. int CALLING fxPlaySample(unsigned channel, unsigned sample, int priority,
  182.     unsigned rate, unsigned volume, int panning, unsigned *playHandle);
  183.  
  184.  
  185.  
  186.  
  187. /****************************************************************************\
  188. *
  189. * Function:     int fxStopSample(unsigned playHandle)
  190. *
  191. * Description:  Stops playing a sample
  192. *
  193. * Input:        unsigned playHandle     sample playing handle (from
  194. *                                       fxPlaySample)
  195. *
  196. * Returns:      MIDAS error code
  197. *
  198. \****************************************************************************/
  199.  
  200. int CALLING fxStopSample(unsigned playHandle);
  201.  
  202.  
  203.  
  204. /****************************************************************************\
  205. *
  206. * Function:     int fxSetSampleRate(unsigned playHandle, ulong rate)
  207. *
  208. * Description:  Changes the sample rate for a sample that is being played
  209. *
  210. * Input:        unsigned playHandle     sample playing handle (from
  211. *                                       fxPlaySample)
  212. *               ulong rate              new rate
  213. *
  214. * Returns:      MIDAS error code
  215. *
  216. \****************************************************************************/
  217.  
  218. int CALLING fxSetSampleRate(unsigned playHandle, ulong rate);
  219.  
  220.  
  221.  
  222.  
  223. /****************************************************************************\
  224. *
  225. * Function:     int fxSetSampleVolume(unsigned playHandle, unsigned volume)
  226. *
  227. * Description:  Changes the volume for a sample that is being played
  228. *
  229. * Input:        unsigned playHandle     sample playing handle (from
  230. *                                       fxPlaySample)
  231. *               unsigned volume         new volume
  232. *
  233. * Returns:      MIDAS error code
  234. *
  235. \****************************************************************************/
  236.  
  237. int CALLING fxSetSampleVolume(unsigned playHandle, unsigned volume);
  238.  
  239.  
  240.  
  241.  
  242. /****************************************************************************\
  243. *
  244. * Function:     int fxSetSamplePanning(unsigned playHandle, int panning)
  245. *
  246. * Description:  Changes the panning position for a sample that is being played
  247. *
  248. * Input:        unsigned playHandle     sample playing handle (from
  249. *                                       fxPlaySample)
  250. *               int panning             new panning position
  251. *
  252. * Returns:      MIDAS error code
  253. *
  254. \****************************************************************************/
  255.  
  256. int CALLING fxSetSamplePanning(unsigned playHandle, int panning);
  257.  
  258.  
  259.  
  260.  
  261. /****************************************************************************\
  262. *
  263. * Function:     int fxSetSamplePriority(unsigned playHandle, int priority)
  264. *
  265. * Description:  Changes the priority for a sample that is being played
  266. *
  267. * Input:        unsigned playHandle     sample playing handle (from
  268. *                                       fxPlaySample)
  269. *               int priority            new playing priority
  270. *
  271. * Returns:      MIDAS error code
  272. *
  273. \****************************************************************************/
  274.  
  275. int CALLING fxSetSamplePriority(unsigned playHandle, int priority);
  276.  
  277.  
  278. #ifdef __cplusplus
  279. }
  280. #endif
  281.  
  282.  
  283. #endif      /* #ifdef __midasfx_h */
  284.  
  285.  
  286. /*
  287.  * $Log: midasfx.h,v $
  288.  * Revision 1.3  1997/01/16 18:41:59  pekangas
  289.  * Changed copyright messages to Housemarque
  290.  *
  291.  * Revision 1.2  1996/09/28 06:39:22  jpaana
  292.  * Converted from CR/LF and fixed some typos
  293.  *
  294.  * Revision 1.1  1996/09/22 23:17:48  pekangas
  295.  * Initial revision
  296.  *
  297. */
  298.